# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from inary.actionsapi import get
from inary.actionsapi import inarytools
from inary.actionsapi import shelltools
from inary.actionsapi import pythonmodules

def build():
    if get.buildTYPE() == "emul32":
        shelltools.system("gcc -m32 src/iksemel.c -o libiksemel.so -shared")
        return
    pythonmodules.compile(pyVer='3')
    shelltools.system("gcc src/iksemel.c -o libiksemel.so -shared")

def install():
    if get.buildTYPE() == "emul32":
        inarytools.dodir("/lib32")
        shelltools.system("install libiksemel.so {}/lib32/".format(get.installDIR()))
        return
    inarytools.dodir("/lib")
    inarytools.dodir("/usr/include")
    pythonmodules.install("--install-lib=/usr/lib/sulin",pyVer='3')
    shelltools.system("install libiksemel.so {}/lib/".format(get.installDIR()))
    shelltools.system("install src/iksemel.h {}/usr/include/".format(get.installDIR()))
